package com.guoxin.part4.chapter16;

/**
 * @author guoxin
 * @date 2019/8/30
 */
public class FlightSecurityTest {

    static class Passengers extends Thread {
        private final FlightSecurity flightSecurity;
        private final String idCard;
        private final String boardingPass;

        Passengers(FlightSecurity flightSecurity, String idCard,
                String boardingPass) {
            this.flightSecurity = flightSecurity;
            this.idCard = idCard;
            this.boardingPass = boardingPass;
        }

        @Override public void run() {
            while (true) {
                flightSecurity.pass(boardingPass, idCard);
            }
        }
    }

    public static void main(String[] args) {
        final FlightSecurity flightSecurity = new FlightSecurity();
        new Passengers(flightSecurity, "A123456", "AF123455").start();
        new Passengers(flightSecurity, "B123456", "BF123455").start();
        new Passengers(flightSecurity, "C123456", "CF123455").start();
    }
}
